package com.pcjavanet.generate;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class AnalysisBean extends ClassLoader{
	
	public   Class findClass(String name,String fullPathName)
    {
         byte [] data  =  loadClassData(fullPathName);
         return  defineClass(name, data,  0 , data.length);
    }
	
	public static byte[] loadClassData(String fullPathName) {
		FileInputStream fis = null;
		byte[] data = null;
		try {
			fis = new FileInputStream(new File(fullPathName));
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			int ch = 0;
			while ((ch = fis.read()) != -1) {
				baos.write(ch);

			}
			data = baos.toByteArray();
		} catch (IOException e) {
			e.printStackTrace();
		}

		return data;
	}

}
